//
//  YXPlayerCacheFileManger.swift
//  swift_wobo
//
//  Created by yuxin on 2018/12/3.
//  Copyright © 2018 wuxiantianli. All rights reserved.
//

import UIKit

class YXPlayerCacheFileManger: NSObject {
    
    
    static public func cacheDirectory() -> String {
        return NSTemporaryDirectory().appending("YXplayerCache") 
    }
    
    static func cacheFilePath(url: URL) -> String {
        
        if let cacheFolder = url.lastPathComponent.components(separatedBy: ".").first {
            let cacheFilePath = (cacheDirectory().appending("/\(cacheFolder)") as NSString).appendingPathComponent(url.lastPathComponent)
            print(cacheFilePath)
            return cacheFilePath
        }
        return (cacheDirectory() as NSString).appendingPathComponent(url.lastPathComponent)
        
    }
}
